Problem with regexp when executing dxl from menu

Hi all,

I'm creating an script to parse a string and it is working perfectly when I run it from the DXL interaction. This is the regexp:

Regexp divisionItems = regexp2 "^(.*)¡¡(.*)$"

But, when I call the same script from a menu option the same string does not match the regexp.

Is there any limitation regarding regexp and dxl calls from menus?

I'm using 9.5.2 and the regexp2 instead of regexp.

Many thanks in advance for your help.

BR,

Paco


Francisco Lopez - Wed May 21 13:42:42 EDT 2014

Re: Problem with regexp when executing dxl from menu
llandale - Wed May 21 16:23:56 EDT 2014

I've never seen ANY difference between code run from the interaction window and that run from the menu.  I will safely say that there is no difference.

Having said that,

  • "No difference" means presumably the interaction window code is simply an #include statement to the exact same file as in the Menu
  • There may be a "context" difference; depending on whether the interaction window was invoked from the Explorer or from an Open module, and whether the script is likewise from an Explorer menu or a Formal menu.  Be advised that when the DXL window is invoked from the Explorer and THEN from the module, it is now "from the module'.  The opposite is not true, if invoked from the module and THEN from the Explorer, it is still tied to the module (as evidenced by trying to get the "current module", and also the windows closes when the module closes).

I suggest therefore you are not running the same code; or perhaps you are not retrieving the same comparison string.  You may want to post it.  Or add a print statement "hello" at the top, and make sure it prints with both invocations.

-Louie

Re: Problem with regexp when executing dxl from menu
Francisco Lopez - Thu May 22 01:10:35 EDT 2014

llandale - Wed May 21 16:23:56 EDT 2014

I've never seen ANY difference between code run from the interaction window and that run from the menu.  I will safely say that there is no difference.

Having said that,

  • "No difference" means presumably the interaction window code is simply an #include statement to the exact same file as in the Menu
  • There may be a "context" difference; depending on whether the interaction window was invoked from the Explorer or from an Open module, and whether the script is likewise from an Explorer menu or a Formal menu.  Be advised that when the DXL window is invoked from the Explorer and THEN from the module, it is now "from the module'.  The opposite is not true, if invoked from the module and THEN from the Explorer, it is still tied to the module (as evidenced by trying to get the "current module", and also the windows closes when the module closes).

I suggest therefore you are not running the same code; or perhaps you are not retrieving the same comparison string.  You may want to post it.  Or add a print statement "hello" at the top, and make sure it prints with both invocations.

-Louie

Louie, many thanks for your answer. 

I've checked and I'm sure I'm invoking the same code from both menu and dxl interaction.

The string to be parsed seems to be the same (attached), but I think here can be the problem and as you mention it may be related to a context difference.

I explain: the string to parse, oleResult, is obtained in a call to a DLL method:

oleError = oleMethod(myCOM, "callFindObjectsDOORS", eArgs, oleResult)

where callFindObjectsDOORS get a list of items according to the conditions defined in eArgs.

This is how the COM object is created:

OleAutoObj myCOM = oleCreateAutoObject("FindObjectDoorsDLL.FindObjectDoors")

I don't know if there is any special consideration with context, enconding, ..., in this oleResult string...

Many thanks again for your help.

Paco


Attachments

string.txt

Re: Problem with regexp when executing dxl from menu
Francisco Lopez - Thu May 22 04:35:58 EDT 2014

Francisco Lopez - Thu May 22 01:10:35 EDT 2014

Louie, many thanks for your answer. 

I've checked and I'm sure I'm invoking the same code from both menu and dxl interaction.

The string to be parsed seems to be the same (attached), but I think here can be the problem and as you mention it may be related to a context difference.

I explain: the string to parse, oleResult, is obtained in a call to a DLL method:

oleError = oleMethod(myCOM, "callFindObjectsDOORS", eArgs, oleResult)

where callFindObjectsDOORS get a list of items according to the conditions defined in eArgs.

This is how the COM object is created:

OleAutoObj myCOM = oleCreateAutoObject("FindObjectDoorsDLL.FindObjectDoors")

I don't know if there is any special consideration with context, enconding, ..., in this oleResult string...

Many thanks again for your help.

Paco

I've tried it in DOORS 9.3.0.1 and it works perfectly...

Maybe this is a bug in 9.5.2... I'll report it.

Thanks for your help!

Re: Problem with regexp when executing dxl from menu
Mike.Scharnow - Thu May 22 06:58:06 EDT 2014

Just one additional idea: I see that you are searching for the Spanish inverted exclamation mark as separator. Could it be that either in 9.5.2 or in the menu call some other language is set, so that the exclamation mark has a different code point?

BR,
Mike

Re: Problem with regexp when executing dxl from menu
sekrbo - Fri May 23 03:58:34 EDT 2014

Mike.Scharnow - Thu May 22 06:58:06 EDT 2014

Just one additional idea: I see that you are searching for the Spanish inverted exclamation mark as separator. Could it be that either in 9.5.2 or in the menu call some other language is set, so that the exclamation mark has a different code point?

BR,
Mike

Ah, now I remember! In what format did you save the DXL file? If it is not in UTF-8 you may get problems with special characters when you run the script from the menu. However, if you cut and past the file into the DXL editor, the problem disappears as the charaters are now converted... I've had exactly that problem with Swedish characters like ÅÄÖ!

/sekrbo

Re: Problem with regexp when executing dxl from menu
Francisco Lopez - Fri May 23 05:52:10 EDT 2014

sekrbo - Fri May 23 03:58:34 EDT 2014

Ah, now I remember! In what format did you save the DXL file? If it is not in UTF-8 you may get problems with special characters when you run the script from the menu. However, if you cut and past the file into the DXL editor, the problem disappears as the charaters are now converted... I've had exactly that problem with Swedish characters like ÅÄÖ!

/sekrbo

Mike, sekrbo, the problem is already solved following your suspictions.

I used:

pragma encoding, "UTF-8"

and after your comments and after reading this post https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000014461891&ps=25

I removed that line and now it is working fine from both the dxl interaction and the menu.

Many thanks for your help!

Paco